ropensci / RSelenium

An R client for Selenium Remote WebDriver
https://docs.ropensci.org/RSelenium
341 stars 81 forks source link

Can't open Chrome browser using rsDriver() function #189

Open wjiarao opened 5 years ago

wjiarao commented 5 years ago

Since Firefox version 48, Mozilla requires all add-ons to be signed. Until recently, Firefox support in Selenium was exclusively provided by an add-on. As this add-on is not currently signed, this solution does not work with the latest Firefox releases. As an alternative, Mozilla are working on a WebDriver specification compliant implementation named GeckoDriver. Please note that the specification is not complete, and that Selenium itself does not comply with the specification at this time. This means that features previously available through Selenium will not be available using GeckoDriver.

Currently we would advise against using the latest firefox/geckodriver with selenium untill the w3c webdriver specification is complete. If you wish to use firefox we would advise using an older version via a Docker image. See the RSelenium Docker vignette for more detail:

http://rpubs.com/johndharrison/RSelenium-Docker

If your issue is not with geckodriver/firefox please fill out the template

Operating System

Windows 7 64 bit

Selenium Server version (selenium-server-standalone-3.0.1.jar etc.)

selenium-server-standalone-3.4.0.jar

Browser version (firefox 50.1.0, chrome 54.0.2840.100 (64-bit) etc.)

Chrome:69.0

Other driver version (chromedriver 2.27, geckodriver v0.11.1, iedriver x64_3.0.0, PhantomJS 2.1.1 etc.)

ChromeDriver: 2.42

Expected behaviour

Open Chrome

Actual behaviour

An Error

Steps to reproduce the behaviour

library(RSelenium) rD <- rsDriver()

An error

checking Selenium Server versions: BEGIN: PREDOWNLOAD Error in open.connection(con, "rb") : schannel: failed to receive handshake, SSL/TLS connection failed

Added port and browser

rD <- rsDriver(port = 4567L, browserName = "chrome", version = "latest",chromever = "latest")

And the same error occured.

checking Selenium Server versions: BEGIN: PREDOWNLOAD Error in open.connection(con, "rb") : schannel: failed to receive handshake, SSL/TLS connection failed #################################################### Untill now, I can't solve this promble.

juyeongkim commented 5 years ago

This looks like a curl error. Which version of curl do you have installed? What's the version of Rtools on your machine?

You are getting this curl error when rsDriver is trying to check and fetch new version of binaries, so try this rsDriver(check = FALSE).

wjiarao commented 5 years ago

@juyeongkim Thanks for your advice. The version of RTools was Rtools35.exe (link:https://cran.r-project.org/bin/windows/Rtools/Rtools35.exe), the version of curl was 3.2. When I try rsDriver(check = FALSE) that's an error following below Error: version is not a character vector. The version of curl was the error? Hopfully to your relply.

brunoruas2 commented 5 years ago

I have a similar issue when i try run RSelenium using chrome.

` library(rJava) library(xlsxjars) library(readxl) library(varhandle) library(readr) library(stringr) library(qdapRegex) library(data.table) library(dplyr) library(beepr) library(scales) library(tibble) library(tidyverse) library(rvest) library(xml2) library(knitr) library(RSelenium) library(rMouse) library(xlsx) library(lubridate)

options(scipen = 999)

rD <- rsDriver(browser = c('chrome'))

` The chrome window open, and its freeze until close. The message of error:

` Selenium message:unknown error: unable to discover open pages (Driver info: chromedriver=72.0.3626.7 (efcef9a3ecda02b2132af215116a03852d08b9cb),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 60.20 seconds Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: 'XX-XX-XX', ip: 'XX-XX-XX', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_191' Driver info: driver.version: unknown

Could not open chrome browser. Client error message: Summary: UnknownError Detail: An unknown server-side error occurred while processing the command. Further Details: run errorDetails method Check server log for further details. `

ponnet commented 5 years ago

I had the error before - the following options solved the issue (I think '--no-sandbox' is most important) : library(wdman) library(RSelenium) cDrv <- chrome() eCaps <- list(chromeOptions = list( args = c('--no-sandbox','--headless', '--disable-gpu', '--window-size=1280,800') )) remDr<- remoteDriver(browserName = "chrome", port = 4567L, extraCapabilities = eCaps) remDr$open()

aguga491 commented 5 years ago

Hi Ponnet, i tried execute your code, but not sucessfull.

library(wdman) library(RSelenium) cDrv <- chrome() checking chromedriver versions: BEGIN: PREDOWNLOAD BEGIN: DOWNLOAD BEGIN: POSTDOWNLOAD eCaps <- list(chromeOptions = list(

  • args = c('--no-sandbox','--headless', '--disable-gpu', '--window-size=1280,800')
  • )) remDr<- remoteDriver(browserName = "chrome", port = 4567L,
  • extraCapabilities = eCaps) remDr$open() [1] "Connecting to remote server"

Selenium message:session not created: This version of ChromeDriver only supports Chrome version 76 Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10' System info: host: 'E5470', ip: '172.21.19.113', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '9' Driver info: driver.version: unknown remote stacktrace: Backtrace: Ordinal0 [0x01017C93+1473683] Ordinal0 [0x00F9ADB1+961969] Ordinal0 [0x00F242E3+475875] Ordinal0 [0x00EBF365+62309] Ordinal0 [0x00EBBC77+48247] Ordinal0 [0x00ED9149+168265] Ordinal0 [0x00ED8D1D+167197] Ordinal0 [0x00ED742B+160811] Ordinal0 [0x00EC0AE6+68326] Ordinal0 [0x00EC1BF0+72688] Ordinal0 [0x00EC1B89+72585] Ordinal0 [0x00FB4B77+1067895] GetHandleVerifier [0x010B6875+506677] GetHandleVerifier [0x010B6610+506064] GetHandleVerifier [0x010BD1B8+533624] GetHandleVerifier [0x010B704A+508682] Ordinal0 [0x00FAC266+1032806] Ordinal0 [0x00FAC0DF+1032415] Ordinal0 [0x00FB6A8B+1075851] Ordinal0 [0x00FB6BF3+1076211] Ordinal0 [0x00FB5BA5+1072037] BaseThreadInitThunk [0x76BD8494+36] RtlAreBitsSet [0x776C41C8+136] RtlAreBitsSet [0x776C4198+88]

Error: Summary: SessionNotCreatedException Detail: A new session could not be created. Further Details: run errorDetails method

Can you help-me, please?!

ponnet commented 5 years ago

It looks to me like you need to explicitly specify the version of the chrome driver that matches the version of your chrome browser

aguga491 commented 5 years ago

Hello,

I try specify but the same error happen. I try with chome beta too, not well. Thanks for your answer i try to with firefox and IE but not sucessfull.

library(RSelenium)

binman::list_versions("geckodriver")

binman::list_versions("iedriverserver")

binman::list_versions("firefox")

binman::list_versions("selenium_ver") $generic [1] "3.141.59" "4.0.0-alpha-1" "4.0.0-alpha-2"

binman::list_versions("chromedriver") $win32 [1] "75.0.3770.140" "76.0.3809.25" "76.0.3809.68"

cprof <- getChromeProfile(

  • "C:\Users\Dell\AppData\Local\Google\Chrome Beta\User Data",
  • "Default"
  • )

driver <- rsDriver(port = 4567L,browser=c("chrome"), , extraCapabilities = cprof) Selenium message:session not created: This version of ChromeDriver only supports Chrome version 76 Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10' System info: host: 'E5470', ip: '172.21.19.113', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '9'

or

driver <- rsDriver(browser=c("chrome"), version = "75.0.3770.140") checking Selenium Server versions: BEGIN: PREDOWNLOAD BEGIN: DOWNLOAD BEGIN: POSTDOWNLOAD Error in selenium_ver(selplat, version) : version requested doesnt match versions available = 3.141.59,4.0.0-alpha-1,4.0.0-alpha-2

Danny-dK commented 5 years ago

You're not specifying the version correctly:

library(RSelenium)
rD1 <- rsDriver(browser = "chrome", port = 4567L, geckover = NULL, chromever = "74.0.3729.6", iedrver = NULL, phantomver = NULL, extraCapabilities = ecap)
remDr1 <- rD1[["client"]]

The option "version" is to specify the seleniumserver version, while the option "chromever" (and the others) are related to the chrome driver version. Choose the chrome driver version that most closely resembles your chrome version.

akankshavarshney25 commented 4 years ago

rD <- rsDriver(port = 4567L,browser = c("chrome"),chromever = "83.0.4103.39")

I seem to get the same error - am supplying the Chrome version as displayed under Help on the Chrome browser; also the installed Chrome Driver exactly matches with this version number

Danny-dK commented 4 years ago

rD <- rsDriver(port = 4567L,browser = c("chrome"),chromever = "83.0.4103.39")

I seem to get the same error - am supplying the Chrome version as displayed under Help on the Chrome browser; also the installed Chrome Driver exactly matches with this version number

Chrome 83.0.4103.39 is quite new(?) I did have this version of chrome but not the driver available. Your driver for it might also not be installed yet. Check (even though you said you have it):

library(binman)  
list_versions("chromedriver")

Check whether an 83 is present. If not, choose the one closest to your chromever and input it in Rselenium. It should check for new drivers and install them when required. Rselenium will throw an error, but when I checked list_versions() again, it showed the correct drivers present and I could proceed with the correct driver.

To attempt to automatically choose the right driver, try this which is a slight modification from this.

akankshavarshney25 commented 4 years ago

Thanks for the response, Danny!

Yes, I agree that the 83 version of Chrome is pretty new - my chrome is always updated, that's the reason, I guess! Also, I did check the installed chromedriver version earlier as well; posting the command's output here as well:

image

To attempt to automatically choose the right driver, try this which is a slight modification from this.

I tried the solution mentioned under this link - but if I remember correctly. some other errors cropped up and somehow couldn't work out on those. Will try out my luck again, thanks!

brbell01 commented 3 years ago

Thanks for the response, Danny!

Yes, I agree that the 83 version of Chrome is pretty new - my chrome is always updated, that's the reason, I guess! Also, I did check the installed chromedriver version earlier as well; posting the command's output here as well:

image

To attempt to automatically choose the right driver, try this which is a slight modification from this.

I tried the solution mentioned under this link - but if I remember correctly. some other errors cropped up and somehow couldn't work out on those. Will try out my luck again, thanks!

Thanks to you also, Danny. I was able to get to get an RSelenium server session up and running by both specifying the chromever, and also specifying a new port:

driver <- rsDriver(port = 4585L, version = "latest", browser=c("chrome"), chromever = "87.0.4280.88")

Apparently the port 4567L was already in use.

Danny-dK commented 2 years ago

update: please see the great work of salim-b at #237 for proper detection of chrome driver

Mgavahi commented 2 years ago

Hi I when use binman::last_version("chromedrive") getting this error. Error: ~/.local/share/binman_chromedrive app directory not found.

Danny-dK commented 2 years ago

@Mgavahi Had the same once, especially if never running Rselenium or wdman codes before, nothing is downloaded to a binman directory (as it just not exists). Try running:

library(binman)
library(wdman)

chrome(
  port = 4568L,
  version = "latest",
  check = TRUE,
  verbose = TRUE,
  retcommand = FALSE
)

You may get some error messages, but even with errrors, then try running

library(binman)
list_versions("chromedriver")

EDIT:: But also note that your code specifies chromedrive which should be chromedriver.

Mgavahi commented 2 years ago

@Danny-dK I'm tired of trying every way to exit R Selenium and get nothing but errors! I don't know what's the problem. chrome( port = 4445L, version = "latest", check = TRUE, verbose = TRUE, retcommand = FALSE ) checking chromedriver versions: BEGIN: PREDOWNLOAD Error in open.connection(con, "rb") : HTTP error 401.

Danny-dK commented 2 years ago

@Mgavahi Did you try the list_versions() after the chrome() command regardless of the errors of chrome()? The code runs fine for me so this may be an issue at your own setup. A quick google on the error returns various issues where code runs fine for others but not for an individual which could result from different systems setup. Are you running from a work computer? Could you try install R, binman, wdman , Rselenium on another computer and try? Examples of google returns a.o.:

https://stackoverflow.com/questions/53389115/rselenium-throwing-error-on-initializing-http-403 https://community.rstudio.com/t/error-in-open-connection-con-rb/3850 https://github.com/ropensci/RSelenium/issues/136 https://stackoverflow.com/questions/37794368/error-in-open-connectionx-rb-couldnt-connect-to-server