Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined error in RCurl call. Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts)) : #54

Closed
englianhu opened this issue Aug 9, 2015 · 24 comments

Comments

@englianhu
Copy link

> checkForServer(update = TRUE)
[1] "DOWNLOADING STANDALONE SELENIUM SERVER. THIS MAY TAKE SEVERAL MINUTES"
trying URL 'http://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.0.jar'
Content type 'application/java-archive' length 31781371 bytes (30.3 MB)
==================================================
downloaded 30.3 MB

> startServer()
> remDrv <- remoteDriver()
> remDrv$open()
[1] "Connecting to remote server"
Undefined error in RCurl call.
Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts)) : 

> require(RSelenium)
> user <- "johnharrison" 
> pass <- "*******************"
> port <- 80
> ip <- paste0(user, ':', pass, "@hub.browserstack.com")
> extraCapabilities <- list("browser" = "IE",
+                           "browser_version" = "7.0",
+                           "os" = "Windows",
+                           "os_version" = "XP",
+                           "browserstack.debug" = "true")
> remDr <- remoteDriver$new(remoteServerAddr = ip, port = port
+                           , extraCapabilities = extraCapabilities)
> remDr$open()
[1] "Connecting to remote server"
Error:   Summary: UnknownError
     Detail: An unknown server-side error occurred while processing the command.

Loaded RCurl and RSelenium but unable open any browser, may I know any solution?
https://cran.r-project.org/web/packages/RSelenium/vignettes/RSelenium-headless.html

@suensummit
Copy link

++
Got the same error.

> require(RSelenium)
Loading required package: RSelenium
Loading required package: RCurl
Loading required package: bitops
Loading required package: RJSONIO
Loading required package: XML
> RSelenium::startServer()
> remDr <- remoteDriver(remoteServerAddr = "localhost"
+ , port = 4444
+ , browserName = "firefox"
+ )
> remDr$open()
[1] "Connecting to remote server"
Error:   Summary: UnknownError
     Detail: An unknown server-side error occurred while processing the command.
     class: org.openqa.selenium.WebDriverException
> remDr$getStatus()
$build
$build$version
[1] "2.47.0"

$build$revision
[1] "0e4837e"

$build$time
[1] "2015-07-29 22:56:05"

$os
$os$name
[1] "Mac OS X"

$os$arch
[1] "x86_64"

$os$version
[1] "10.10.4"

$java
$java$version
[1] "1.7.0_79"
> 

@englianhu
Copy link
Author

> require(RSelenium)
> RSelenium::startServer()
> remDr$open()
[1] "Connecting to remote server"
Undefined error in RCurl call.
Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts)) : 

> remDr$getStatus()
Undefined error in RCurl call.
Error in queryRD(paste0(serverURL, "/status")) : 

Worse than you, my friend... remDr$getStatus()
we need asist from author

@RobertMyles
Copy link

Having the same problem here! I've searched high and low for an answer but nothing yet unfortunately.

library(RSelenium)
checkForServer()
remDr <- remoteDriver()
remDr$getStatus()
startServer()
remDr$open()
[1] "Connecting to remote server"
Undefined error in RCurl call.
Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts)) : 

@RobertMyles
Copy link

Update: after downloading the selenium standalone server, putting it in a folder (my R workspace folder), and clicking on it manually, it seemed to work:

> remDr$open()
[1] "Connecting to remote server"
$applicationCacheEnabled
[1] TRUE

$rotatable
[1] FALSE

$handlesAlerts
[1] TRUE

$databaseEnabled
[1] TRUE

$version
[1] "39.0.3"

$platform
[1] "MAC"

$nativeEvents
[1] FALSE

$acceptSslCerts
[1] TRUE

$webdriver.remote.sessionid
[1] "85cf80e6-f7bb-4c0f-a932-f033f2870465"

$webStorageEnabled
[1] TRUE

$locationContextEnabled
[1] TRUE

$browserName
[1] "firefox"

$takesScreenshot
[1] TRUE

$javascriptEnabled
[1] TRUE

$cssSelectorsEnabled
[1] TRUE

$id
[1] "85cf80e6-f7bb-4c0f-a932-f033f2870465"

> remDr$getStatus()
$build
$build$version
[1] "2.47.1"

$build$revision
[1] "411b314"

$build$time
[1] "2015-07-30 03:03:16"


$os
$os$name
[1] "Mac OS X"

$os$arch
[1] "x86_64"

$os$version
[1] "10.10.3"


$java
$java$version
[1] "1.8.0_51"

@lli48
Copy link

lli48 commented Sep 5, 2015

I am having the same problem and trying the solution you posted. But how can I find where I download the selenium standalone server?

@RobertMyles
Copy link

Hi lli48, if you search your computer for "selenium-server-standalone.jar" you should find it. I manually clicked on this, and then had no more problems with the browser.

@private-quant
Copy link

RoberyMyles is right. It will throw an error depending on your security settings. You must approve the .jar to run from an unknown author (depending on your security settings).

@englianhu
Copy link
Author

@olivmx
Copy link

olivmx commented Dec 7, 2015

Ok I was able to solve this for Mac OS 10.10.5:

  1. First find the selenium-server-standalone.jar in your mac. and copy it to your R working directory folder

    If you have already issued this command in R:

install.packages("RSelenium")

Then you should have the .jar already somewhere in your Hard Drive, but property of root user, so in order to find it I had to issue some commands in Terminal:

#change folder to top
cd /
# find file with root user. this might ask for your password:
sudo find -L . | grep selenium-server-standalone.jar

# copy the file to the getwd() folder in R; so in R issue the getwd() to see where to copy the .jar file in my case it was: 
sudo cp ./Library/Frameworks/R.framework/Versions/Current/Resources/library/RSelenium/bin/selenium-server-standalone.jar /Users/me

#change the security of the copied file (some might find this overkill permits)
cd /Users/me
sudo chmod 777 selenium*

Now find the .jar file with finder, right click on it and open it using with Jar Launcher app
If you don't have this Jar Launcher app find the java complement in apple site and install it
https://support.apple.com/en-us/HT204036

That should solve it

@thomasKuilman
Copy link

Hi guys,

For me the problem was that startServer() function does not work. Internally it starts the selenium-server-standalone.jar (in file.path(find.package("RSelenium"), "bin") folder) as follows:

java -jar /PATH/TO/selenium-server-standalone.jar

but for me this failed due to an outdated java version (1.6). Updating to the latest 1.7 version solved things. You could test on the command line whether the line above works; if you get an error message this is likely the reason for your error message.

Cheers,

Thomas

@arvi1000
Copy link

arvi1000 commented Jan 4, 2016

+1 @thomasKuilman. startServer() fails for me too. It attempts to run this:

java -jar /Library/Frameworks/R.framework/Versions/3.2/Resources/library/RSelenium/bin/selenium-server-standalone.jar

and returns no message, but when I try the above from the command line I get Invalid or corrupt jarfile. (Also using java version 1.6, on Mac OS X 10.9)

@sulaxd
Copy link

sulaxd commented Jan 5, 2016

+1 @thomasKuilman

@englianhu
Copy link
Author

@olivmx I tried to grant permission by $ sudo chmod 777 /usr/lib64/R/library/RSelenium/bin/selenium-server-standalone.jar to run the selenium-server file.

> checkForServer(update = TRUE)
[1] "DOWNLOADING STANDALONE SELENIUM SERVER. THIS MAY TAKE SEVERAL MINUTES"
--2016-01-21 09:53:21--  http://selenium-release.storage.googleapis.com/2.49/selenium-server-standalone-2.49.0.jar
Resolving selenium-release.storage.googleapis.com (selenium-release.storage.googleapis.com)... 2a00:1450:400c:c01::80, 74.125.195.128
Connecting to selenium-release.storage.googleapis.com (selenium-release.storage.googleapis.com)|2a00:1450:400c:c01::80|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 30947958 (30M) [application/java-archive]
Saving to: ‘/usr/lib64/R/library/RSelenium/bin/selenium-server-standalone.jar’

     0K .......... .......... .......... .......... ..........  0% 3.48M 8s
    50K .......... .......... .......... .......... ..........  0% 5.94M 7s
   100K .......... .......... .......... .......... ..........  0% 7.69M 6s
 ...
 30100K .......... .......... .......... .......... .......... 99%  235M 0s
 30150K .......... .......... .......... .......... .......... 99%  223M 0s
 30200K .......... .......... ..                              100%  199M=0.6s

- utime(/usr/lib64/R/library/RSelenium/bin/selenium-server-standalone.jar): Operation not permitted
2016-01-21 09:53:22 (52.3 MB/s) - ‘/usr/lib64/R/library/RSelenium/bin/selenium-server-standalone.jar’ saved [30947958/30947958]

> startServer()
> remDrv <- remoteDriver()
> remDrv$open()
[1] "Connecting to remote server"
- Undefined error in RCurl call.
- Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts)) :

and noticed there is an error utime(/usr/lib64/R/library/RSelenium/bin/selenium-server-standalone.jar): Operation not permitted. Is that caused to queryRD error?

> devtools::session_info()$platform
 setting  value                       
 version  R version 3.2.3 (2015-12-10)
 system   x86_64, linux-gnu           
 ui       RStudio (0.99.839)          
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/New_York            
 date     2016-01-21

@PavoDive
Copy link

For the sake of completeness to those who know what's going on with this error.
I have the follwing code in a function:

startServer()
remDrv <- remoteDriver()
remDrv$open()

When I run it for the first time, I get same error as most people here:

[1] "Connecting to remote server"
- Undefined error in RCurl call.
- Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts)) 

But if I re-run the function (without any other change), then it runs smoothly.

> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=Spanish_Colombia.1252  LC_CTYPE=Spanish_Colombia.1252    LC_MONETARY=Spanish_Colombia.1252 LC_NUMERIC=C                      LC_TIME=Spanish_Colombia.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] stringi_1.0-1   RSelenium_1.3.5 XML_3.98-1.3    RJSONIO_1.3-0   RCurl_1.95-4.7  bitops_1.0-6   

loaded via a namespace (and not attached):
[1] tools_3.2.3    caTools_1.17.1

@bhattacharya2110
Copy link

Hi.. I have the same issue... I searched for the the selenium-standalone-server and tried to double click on it when I get the error as "could not find the main class:" in the Java virtual machine launcher dialog box.
And it says Program will exit and nothing happens. Can anyone please help.

@ejain1989
Copy link

Hi..I am getting same error.

startServer()
remDrv <- remoteDriver()
remDrv$open()
[1] "Connecting to remote server"

  • Undefined error in RCurl call.
  • Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts))

Could someone please help on this issue. I tried options given in above comments but that's not working.

@daattali
Copy link
Contributor

daattali commented Jul 28, 2016

I'm getting the same issue too

I have two Windows 7 laptops that are very similar, same version of R. On one it works fine, on the other I get this error:

> remDr <- remoteDriver(remoteServerAddr = "localhost" 
+                       , port = 4444
+                       , browserName = "firefox"
+ )
> remDr$open()
[1] "Connecting to remote server"
Undefined error in RCurl call.
Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts)) : 

@KrysD
Copy link

KrysD commented Aug 2, 2016

Any solution to the Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts)) : ?
May be tricky but by installing the latest version of java (8) the problem wa solved.

startServer() # run Selenium Server binary
$stop
function () 
{
    tools::pskill(selPID)
}
<environment: 0x0864e8c4>

$getPID
function () 
{
    return(selPID)
}
<environment: 0x0864e8c4>
remDr <- remoteDriver(browserName="firefox", port=4444) # instantiate remote driver to connect to Selenium Server
> remDr$open(silent=T) # open web browser

@johndharrison
Copy link
Member

See the Selenium changelog:
https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG#L294
and
https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG#L6

So at least Java 7 is required for v >= 2.47 and now Java 8 is required for v >=3

@daattali
Copy link
Contributor

daattali commented Aug 2, 2016

I have java 8 and still got the error

@johndharrison
Copy link
Member

johndharrison commented Aug 2, 2016

There is an issue with firefox 47 and selenium 2.53.1. Firefox released 47.0.1 to fix this
https://www.mozilla.org/en-US/firefox/47.0.1/releasenotes/ however some linux distros are still showing 47.0.0 as latest version. Updating to dev version firefox 48 on ubuntu 16.04 for example worked for me.

@dpost723
Copy link

dpost723 commented Aug 4, 2016

My solution worked on my Mac:

I followed all instructions listed here about opening the .jar file first, which did not work by themselves (although they may be necessary for what did work).

What ended up working for me was downloading an older version of FireFox (I used version 28.0), then I turned off Firefox auto-update, and then everything started working.

I also ran:
java -jar "/LOCATION_OF_YOUR_JAR_FILE/selenium-server-standalone.jar" -Dwebdriver.firefox.bin="/Applications/Firefox"
in the terminal and kept the terminal open while running RSelenium as that helped me with error catching more than anything that showed up in the R console.

Note that there are safety concerns about downloading an older version of a browser so I only use this Firefox while using RSelenium.

@johndharrison
Copy link
Member

johndharrison commented Aug 4, 2016

Happy that worked for you. The java call is:

java [-options] -jar jarfile [args...]
           (to execute a jar file)

in this instance -Dwebdriver.firefox.bin="/Applications/Firefox" is being passed to the JVM. You are passing it to the selenium binary. Up until recently the binary would also parse system property flags
see SeleniumHQ/selenium#2566 . This will change in future versions and you would need to pass the options to the JVM:

java -Dwebdriver.firefox.bin="/Applications/Firefox" -jar "/LOCATION_OF_YOUR_JAR_FILE/selenium-server-standalone.jar"

The Selenium Server in theory should work as follows:

  • Selenium support for Firefox is the latest release, the previous release, the latest ESR release and the previous ESR release.
  • Currently that should be firefox 48, 47.0.1, ESR 45.3.0, ESR 38.8.0
  • Issues can arise if latest or previous release doesnt work with selenium binary you can try an ESR version of firefox
  • Can download previous firefox versions from https://ftp.mozilla.org/pub/firefox/releases/

@mjpegueros
Copy link

Error in queryRD(paste0(serverURL, "/session"), "POST", qdata = toJSON(serverOpts)) :

I solved this problem. Undergrading Mozillafirefox to version 46.0.1 . It worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests