Get stopApp returnValue for vignette

Hi,

I'm building an R package with a shiny gadget. I'd like to show and manipulate the return value of the gadget in the vignette for demonstration purposes. What would be the best way to accomplish this? I've tried the following so far:

  1. Set launch.browser in the call to runApp to a function that uses the webdriver package to connect to the webpage and programmatically press the 'exit' input button, which is observed and triggers stopApp. This works the same way as if the user would stop the app manually. (Inspired by the shinytest package)
  2. At the end of the server function, passed to shinyApp, explicitly call stopApp to stop the app immediately.

(1) works quite well but requires the user to install phantomjs through webdriver, which does not seem to play well with some of the build servers. (2) still requires the user to visit the web page in order to trigger a call to the server function.

Would really appreciate suggestions on how I can either make (1) or (2) work or if there are any better ways to do this!

Thanks!