I faced such an issue: i have Rscript that uses RSelenium to navigate pages, click buttons and collect data. I included this script as a function in my shinyApp. When I run it from my machine everything is as expected: after clicking the button firefox launches and process in running corretly.
The trouble occured when I wanted to publish script on Rstudio server (under Linux) in my company in order to provide access to the tool (written under Windows) by link. After running this:
rD<-rsDriver(port=4441L, browser="firefox", chromever=NULL, iedrver = NULL, phantomver = NULL)
A receive this output:
$client
[1] "No sessionInfo. Client browser is mostly likely not opened."
$server
Process Handle
command : /tmp/RtmpElIBko/file3a0241d505d8.sh
system id : 15293
state : exited
So the server is running, but browser can't be opened
server log is:
$stderr
[1] "14:22:06.908 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.12.0', revision: '7c6e0b3'"
[2] "14:22:06.910 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4441"
[3] "2018-05-15 14:22:07.026:INFO::main: Logging initialized @452ms to org.seleniumhq.jetty9.util.log.StdErrLog"
[4] "14:22:07.227 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4441"
[5] "14:22:08.467 INFO [ActiveSessionFactory.apply] - Capabilities are: Capabilities {browserName: firefox, javascriptEnabled: true, nativeEvents: true, version: }"
[6] "14:22:08.469 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)"
[7] "1526383328500\tgeckodriver\tINFO\tgeckodriver 0.20.1"
[8] "1526383328506\tgeckodriver\tINFO\tListening on 127.0.0.1:30716"
[9] "1526383328777\tmozrunner::runner\tINFO\tRunning command: \"/usr/bin/firefox\" \"-marionette\" \"-profile\" \"/tmp/rust_mozprofile.KCqtcRfWkHTS\""
[10] "No protocol specified"
[11] "Error: cannot open display: :0"
My thoughts: on local machine I had browser installed and it's path is stored in PATH
variable. I had nothing in the server, so it is unclear what should be opened.
What I tried to do: by this time i'm waiting for my IT department to install the browser on server (I even don't know whether it sounds like madness) because I have no permissions. I uploaded Mozilla browser from my computer to the server and ran such a lines to launch browser without RSelenium, directly:
system('java -Dwebdriver.firefox.bin="\\R\\Wordstat Yandex\\Mozilla\\firefox.exe"')
system('java -Dwebdriver.gecko.driver,"R\\Wordstat Yandex\\geckodriver"')
system('export PATH=$PATH:"\\R\\Wordstat Yandex\\Mozilla\\firefox.exe"')
system("./firefox.exe")
which returns permission error:
sh: ./firefox.exe: Permission denied
So my questions are:
- Is it possible to install browser on server (I copied folder and probably is was wrong)
- If answer for point 1 is "yes' then how it should be done corretly (i.e, should it be linux ver. of firefox installed?)
- If answer is "no" then are there any other ways to run Rselenium based scripts within shinyapp from Rstudio server (assumning it works in shinyapp locally)
By this time what I saw in Google was how to test shinyapp using RSelenium. If i put both these words in one search query the result is approximately the same.
Many thanks for any help)