ropensci / RSelenium

An R client for Selenium Remote WebDriver

Home Page:https://docs.ropensci.org/RSelenium

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RSelenium is not working on the shiny server

rezasz969 opened this issue · comments

I have an Rscript that uses RSelenium to web scraping. I included this script as a function in my shinyApp. When I run it from my machine (locally) everything works as expected. The trouble occurs when it is published on the shiny server. When I call the application, it shows the message "Dissconected from the sever".

My shinyApp code:

library(shiny)
library(RSelenium)

ui <- fluiPage(
	actionButton('go', 'Scrape')
	)
	
server <- function(input, output, session){
	observeEvent(input$go, {
		NEW_PATH = paste(Sys.getenv("PATH"), "/usr/lib/jvm/jdk-17/bin/", sep = ":"
		Sys.setenv(PATH)
	
	rs_driver <- rsDriver(browser = 'chrome',
               chromever = '91.0.4472.101',
               port = 4587L,
               verbose = T,
               check = F)
			   
	obj <- rs_driver$client
	
	obj$navigate("http://10.18.33.9:7007/ui/")
	Sys.sleep(1)
	})
}

shinyApp(ui, server)

How can I get this to work on the shiny server? Please help! Thank you so much