4

I am trying to start an RSelenium session to webscrape. However, when running this code:

driver <- rsDriver(browser=c("chrome"), chromever="76.0.3809.126", port = 4444L)

I get this error: Error in java_check() : PATH to JAVA not found. Please check JAVA is installed.

I have installed the right version of Java - I think I somehow need to set the path to Java in R, but I've got no idea how to do this. I'm a data scientist and don't understand how any of the computer stuff works.

I also tried to install Docker to fix this following this tutorial:

https://callumgwtaylor.github.io/blog/2018/02/01/using-rselenium-and-docker-to-webscrape-in-r-using-the-who-snake-database/

but when running this code in the terminal as requested I get:'docker' is not recognized as an internal or external command, operable program or batch file.

Is there anyone who can help?

Thanks

natedjurus
  • 319
  • 3
  • 11

1 Answers1

4

Alternatively, you can run the binary manually. Open a console in your OS and navigate to where the binary is located and run:

java -jar selenium-server-standalone-x.xx.x.jar

  • 1
    Thanks - I did try that but I got: ```Error: Unable to access jarfile selenium-server-standalon-x.xx.x.jar```. Again, I don't really know what I'm doing - might I need to set the path in the cmd prompt or something? – natedjurus Sep 09 '19 at 11:31
  • 1
    Yes, you will have to add the path in the command prompt. But let's start by the beginning. Could you please make sure that you have donwloaded a selenium-server-standalone JAR and tell us the version. If you go to https://docs.seleniumhq.org/download/ you will see "Download version 3.141.59" that will give you selenium-server-standalone-3.141.59.jar. Download this one and tell us where it is on your file system (what is the complete path on your disk). Also, you could please tell us what is your Operating System (Windows 10 ? Linux Ubuntu 19.04 ? MacOS ?) – EfficiencyOverflow Sep 09 '19 at 11:39
  • 1
    Yes! Thank you! It's working now - I downloaded the file as requested then moved it to the directory in my cmd console. I then ran the code with the version number inserted. This then allowed my original code to commence the selenium session. Thanks for your help! – natedjurus Sep 09 '19 at 12:08
  • Hello, I have the same issues. I did what you said but I got this error: `java is not recognized as an internal or external command, operable program or batch file`. Do you know where is the pb, please? Thank you. – Mary Nastase Jun 10 '20 at 20:09
  • Hello @MaryNastase. Could you please tell us what is your Operating System (Windows 10 ? Linux Ubuntu 19.04 ? MacOS ?). Could you also open a terminal (command line) and type "java -version" and tell us the result, so that we can know if java is properly installed on the system and which version you are using ? – EfficiencyOverflow Jun 18 '20 at 07:46