How to open Google Chrome using RSelenium?

I am using RSelenium and I want to open and go to Google Chrome. However, I always get an error message when I want to open a browser from R. The following code is used:

library("RSelenium") startServer() mybrowser <- remoteDriver(browserName = "chrome") mybrowser$open() [1] "Connecting to remote server" Error: Summary: UnknownError Detail: An unknown server-side error occurred while processing the command. class: java.lang.IllegalStateException 

The same code works for Firefox. What can i do with this?

+5
source share
1 answer

Although Google Chrome is installed, there is still something that Selenium does not require. This is a "chrome reverse". "chromedriver" can be downloaded from this website. Currently, the most recent version is 2.25. For example, if you use Windows, you need to download the file "chromedriver_win32.zip".

When the file is downloaded, extract the file into it, that is, "chromedriver.exe". Put "chromedriver.exe" where you want. I put it in "User / Documents / R".

In the last step, you need to add the folder in which "chromedriver.exe" is on the system path. A description of adding a folder to the system path can be found here.

Now you can restart R and run the code.

+4
source

Source: https://habr.com/ru/post/1235281/


All Articles