I am preparing some lectures using binder. In these students should use library(RSelenium) in R . Selenium is a browser automation suite. Using selenium outside of binder requires launching a Selenium server in a docker container:
docker run -d -p 4445:4444 selenium/standalone-firefox
How can I achieve this functionality within binder? I cannot launch docker within binder. Can I run it on the host and have students connect to it?
I am just starting out with binder so please forgive my ignorance. Iāve used it for teaching once and was so happy with it that Iām trying to move everything there as it spares me from dealing with computer configuration issues from students.
The requirements.txt configuration file that is in the current working version of the example binder-ready for selenium works with pip. If I recall correctly, the configurations that involve R arenāt compatible with the requirements.txt approach. I imagine the easiest these days would be to convert a configuration that should include selenium set up properly to use much the same as the ār condaā example, building in there what presently is in the example for selenium requirements.txt. And then youād include the apt.txt of the selenium binder-ready example repo, or the contents if the ār condaā already has an apt.txt. Similar for adapting from the postBuild where selenium works on mybinder to the ār condaā example. Wait. Actually because conda handles things better, I think I was able to remove the apt.txt and postBuild in the example with an environment.yml file for configuration, like the ār conda exampleā uses, here. That latter repo of mine may serve as a better guide for the adapting of ār condaā example to install selenium, too.
To get much more specific guidance, youād need to include a link to your repo.
Thanks for jumping in to help! Essentially, Iām trying to deploy a data scraping app with RShiny and RSelenium, which when I try to open up in the Shinyapp format disconnects from the server. However, when Iāve tried to run it from rstudio (Binder), it looks like RSelenium does start (which suggests that itās installed), but itās missing some dependancies (JAVA) since I get a āWarning: Error in java_check: PATH to JAVA not found. Please check JAVA is installed.ā error message.
I tried the solution suggested here (How to install jdk 17 in mybinder.org) and I added ca-certificates-java and openjdk-17-jre-headless to my apt.txt file, but I got an āreturned a non-zero code: 100ā error (which is why they are no longer in that file).
Any help will be greatly appreciated.
Thanks
That route to installing Java via apt.txt looks more complex than I learned and have been using with success for years. See the top two apt.txt files listed here. I just verified that typing java in a terminal in sessions launched from the top one of those associated repos works presently. And launches from this one, which uses a variation, also works when you type java in a session launched from thereā¦
Those solutions worked! Unfortunately, this just unveiled the next series of issues with getting RSelenium to work properly.
Now I get an error in curl::curl_fetch_disk: Unrecognized content encoding type. I can temporarily avoid this by looping over the rsDriver command and defining the selenium (3.141.59) and geckover (ā0.31.0ā) version instead of having them default to the ālatestā version, but ultimately the connection is refused and it cannot connect to pretty much any port.
From what Iāve seen (e.g. RSelenium::rsDriver() not working as expected. - #3 by lazycipher - General - RStudio Community or Webscraping Aliexpress with Rselenium | R-bloggers) people seem to attribute this to a corrupted jarfile (and indeed when running wdman::selenium(), I get the same error message) and the solution seems to be to download the jar file from the original website and place it the projectās directory. Would you happen to know how to do this in Binder?
I havenāt read the other posts after yours. I didnāt spend much more time getting docker to work, I just used a selenium server standalone jarfile and using that worked smoothly.
thanks for the responses, I tried using a selenium server standalone jarfile through postBuild, while also installing firefox and java through apt.txt but I still canāt get selenium to work. @hliebert would you mind sharing a link to your repository for this project? If not, could you maybe list the dependencies you used and how you implemented them?
Thanks!