ColinFay / crrry

'crrri' recipes for 'shiny'
Other
28 stars 3 forks source link

crrry and "normal" shiny apps: Connection refused #7

Open dmenne opened 3 years ago

dmenne commented 3 years ago

Your example with hexframe works for me (Windows), but any example with "normal" shiny fails (Connection refused). Sample:

test <- crrry::CrrryProc$new(
  chrome_bin = pagedown::find_chrome(),
  chrome_port = httpuv::randomPort(),
  shiny_port = 3838,
  fun = "library(shiny); runExample('01_hello', port = 3838)",
  # Should Chrome be launched headless?
  headless = FALSE
)
dmenne commented 3 years ago

Using suggestions here, I got it to work as follows, but still do not understand why the above example does not work:

p <- processx::process$new(
  "Rscript", 
  c(
    "-e",  
    "options('shiny.port'= 3515); 
    shiny::runApp('ex-insertF7Tab.R', port=3515)" 
  )
)

Sys.sleep(2)

p$is_alive()

test <- crrry::CrrryOnPage$new(
  chrome_bin = pagedown::find_chrome(),
  chrome_port = httpuv::randomPort(),
  url = "http://localhost:3515",
  headless = FALSE
)

test$wait_for_shiny_ready()
test$call_js(
  "var btn = document.getElementById('add');
  btn.click()"
)