Inconsistent behavior in RSelenium

On Linux, RSelenium / Selenium seems to behave erratically. I start the server manually and it seems to start normally. Sometimes I can connect to it from my R session, and sometimes I get an error. I still can not determine the reason: the same script seems to work sometimes, and not at another time. Any ideas?

Here is the result of starting the server:

 12:41:25.811 INFO - Launching a standalone server 12:41:26.102 INFO - Java: Sun Microsystems Inc. 11.0-b16 12:41:26.102 INFO - OS: Linux 2.6.32-431.17.1.el6.x86_64 amd64 12:41:26.157 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf 12:41:26.492 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: LINUX 12:41:26.589 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub 12:41:26.589 INFO - Version Jetty/5.1.x 12:41:26.590 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver] 12:41:26.590 INFO - Started HttpContext[/selenium-server,/selenium-server] 12:41:26.590 INFO - Started HttpContext[/,/] 12:41:36.597 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@2993a66f 12:41:36.598 INFO - Started HttpContext[/wd,/wd] 12:41:36.601 INFO - Started SocketListener on 0.0.0.0:4444 12:41:36.601 INFO - Started org.openqa.jetty.jetty.Server@6f507fb2 

The error I get in my R session:

 Couldnt connect to host on http://localhost:4444/wd/hub. Please ensure a Selenium server is running.Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts)) 

In other cases, running the exact same script succeeds. It may be the difference that the node computer actually runs the script, but I can’t say what the problem is when it will not connect.

+5
source share
2 answers
 library(RCurl) library(RJSONIO) library(XML) # running selenium system("java -jar selenium-server-standalone-2.44.0.jar") 

I ran into the same problem and tried to run the code above. Finally, be aware that there is only support 1.7, but not 1.8. You can try downloading jre7 and jdk7.

+2
source

I encountered the same error on a Mac, but noticed that due to security settings, the system does not allow me to run a file with this piece of code. I downloaded the standalone selenium file and using the control key I clicked once on the file and then from the menu in which I selected open. Then the problem is solved.

+2
source

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


All Articles