RSelenium icon indicating copy to clipboard operation
RSelenium copied to clipboard

Error in open.connection(con, "rb") : Couldn't connect to server

Open zheguzai100 opened this issue 7 years ago • 4 comments

part of powershell: cd xx/selenium ·java -jar .\selenium-server-standalone-3.4.0.jar· 08:12:42.356 INFO - Selenium build info: version: '3.4.0', revision: 'unknown' 08:12:42.356 INFO - Launching a standalone Selenium Server 2017-06-28 08:12:42.496:INFO::main: Logging initialized @721ms to org.seleniumhq.jetty9.util.log.StdErrLog 08:12:42.824 INFO - Driver class not found: com.opera.core.systems.OperaDriver 08:12:42.824 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped: Unable to create new instances on this machine. 08:12:42.824 INFO - Driver class not found: com.opera.core.systems.OperaDriver 08:12:42.824 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered 08:12:42.824 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped: registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN10 2017-06-28 08:12:43.309:INFO:osjs.Server:main: jetty-9.4.3.v20170317 2017-06-28 08:12:43.449:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@28d25987{/,null,AVAILABLE} 2017-06-28 08:12:43.949:INFO:osjs.AbstractConnector:main: Started ServerConnector@3f49dace{HTTP/1.1,[http/1.1]}{0.0.0.0:4444} 2017-06-28 08:12:43.949:INFO:osjs.Server:main: Started @2173ms 08:12:43.949 INFO - Selenium Server is up and running

part of rstudio: library(RSelenium) library(rvest) rd1 <- rsDriver(browser = 'chrome',port = 4567L) checking Selenium Server versions: BEGIN: PREDOWNLOAD Error in open.connection(con, "rb") : Couldn't connect to server

zheguzai100 avatar Jun 27 '17 06:06 zheguzai100

time flies, it's still open. i tried to find the error point, when i run process_yaml(tempyml, verbose) in chrome_check func, it returns BEGIN: PREDOWNLOAD Error in open.connection(con, "rb") : Couldn't connect to server is it the key point ? any help? @johndharrison

tips: 1.path of chrome(59.0.3071.115, x64) is default(C:\Program Files (x86)\Google\Chrome\Application) chromedriver.exe(2.30) is here too. chrome-path was set in env--path 2.selenium-server-standalone-3.4.0 3.java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

zheguzai100 avatar Jun 28 '17 10:06 zheguzai100

@mnel does it means selenium-server run successfully? with this sentence, registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN10

----------------------------------------

PS D:> java -jar D:\R\selenium\selenium-server-standalone-3.4.0.jar 14:47:55.169 INFO - Selenium build info: version: '3.4.0', revision: 'unknown' 14:47:55.185 INFO - Launching a standalone Selenium Server 2017-07-06 14:47:55.243:INFO::main: Logging initialized @693ms to org.seleniumhq.jetty9.util.log.StdErrLog 14:47:55.399 INFO - Driver class not found: com.opera.core.systems.OperaDriver 14:47:55.399 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped: Unable to create new instances on this machine. 14:47:55.415 INFO - Driver class not found: com.opera.core.systems.OperaDriver 14:47:55.415 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered 14:47:55.415 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped: registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN10 2017-07-06 14:47:55.540:INFO:osjs.Server:main: jetty-9.4.3.v20170317 2017-07-06 14:47:55.649:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@28d25987{/,null,AVAILABLE} 2017-07-06 14:47:55.790:INFO:osjs.AbstractConnector:main: Started ServerConnector@3f49dace{HTTP/1.1,[http/1.1]}{0.0.0.0:4444} 2017-07-06 14:47:55.806:INFO:osjs.Server:main: Started @1252ms 14:47:55.806 INFO - Selenium Server is up and running

zheguzai100 avatar Jul 06 '17 06:07 zheguzai100

@johndharrison

way 1

rd1 <- rsDriver(remoteServerAddr = "localhost",port = 4567L, + browser = "chrome") checking Selenium Server versions: BEGIN: PREDOWNLOAD Error in open.connection(con, "rb") : Couldn't connect to server

way 2

remDr <- remoteDriver(browserName = "chrome", port = 4567L,remoteServerAddr="localhost") remDr$open() [1] "Connecting to remote server" Error in checkError(res) : Couldnt connect to host on http://localhost:4567/wd/hub. Please ensure a Selenium server is running.

selenium server status

info above

zheguzai100 avatar Jul 06 '17 07:07 zheguzai100

If you start a selenium server manually it will have a default port of 4444. You may have issues with the default 4444 port with MAC as it runs kerberos service on this port. see https://discussions.apple.com/thread/7598207?start=0&tstart=0 . Use something like

PS D:> java -jar D:\R\selenium\selenium-server-standalone-3.4.0.jar -port 4567

if you wish to run the Selenium Server on port 4567. Your call of

remDr <- remoteDriver(browserName = "chrome", port = 4567L,remoteServerAddr="localhost")

may now working if your OS has the location of the chromedriver see below.

The errors you are getting with the rsDriver function imply that http://selenium-release.storage.googleapis.com/index.html is blocked from your location or something similar. The rsDriver function attempts to download the relevant driver files:

  • the standalone selenium server
  • gecko driver for firefox
  • chrome driver for chrome
  • phantomjs binary
  • iedriver for internet explorer (windows only)

If you have issues running rsDriver then you will need to download the relevant drivers above manually. You may also need to place their location in your PATH or add additional arguments to your java -jar call depending on your OS.

Alternatively you can run a docker container as outlined in the RSelenium: Docker vignette

johndharrison avatar Jul 06 '17 09:07 johndharrison