Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

inconsistent behavior in RSelenium

On Linux, the RSelenium/Selenium seems to be behaving erratically. I start the server manually and it seems to start up fine. Sometimes I am able to connect to it from my R session and other times I get an error. I cannot yet pinpoint the cause: the same script seems to work sometimes and not other times. Any ideas?

Here is the output from 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 receive 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))

Other times, running the exact same script everything proceeds successfully. It could be a difference of what computer node actually executes the script but I cannot tell what the problem is when it will not connect.

like image 844
Alex Avatar asked Sep 30 '22 07:09

Alex


2 Answers

library(RCurl)
library(RJSONIO)
library(XML)

# running selenium
system("java -jar selenium-server-standalone-2.44.0.jar")

I faced same issue and try to run above code. Finally know that there only support 1.7 but not 1.8 as time being. You might try to download jre7 and jdk7.

like image 62
Rγσ ξηg Lιαη Ημ Avatar answered Oct 02 '22 15:10

Rγσ ξηg Lιαη Ημ


I faced the same error in Mac, but I noticed that due to security settings the system does not let me to run the file with that piece of code. I downloaded the selenium standalone file and using control key I single-clicked the file and then from the menu I chose the open. Then the problem get solved.

like image 25
Miros Avatar answered Oct 02 '22 15:10

Miros