Coder Social home page Coder Social logo

Comments (5)

juyeongkim avatar juyeongkim commented on August 18, 2024

@yonicd I finally got to try this out, and I found a solution!!!

Add this code after creating a remoteDrive object:

remDr$queryRD(
  ipAddr = paste0(remDr$serverURL, "/session/", remDr$sessionInfo[["id"]], "/chromium/send_command"),
  method = "POST",
  qdata = list(
    cmd = "Page.setDownloadBehavior",
    params = list(
      behavior = "allow",
      downloadPath = getwd()
    )
  )
)

This sends a command to the headless chrome to allow downloading.

I follow this python solution.

from wdman.

yonicd avatar yonicd commented on August 18, 2024

Wow. I would have never guessed that. Thank you!

from wdman.

wjiarao avatar wjiarao commented on August 18, 2024

A Bug when using head less Chrome, here was my code.

> devtools::session_info()
Session info ----------------------------------------------------------------------------------------------------
setting value
version R version 3.4.1 (2017-06-30)
system x86_64, mingw32
ui RStudio (1.1.383)
language (EN)
collate Chinese (Simplified)_People's Republic of China.936
tz Asia/Taipei
date 2018-10-14

Packages --------------------------------------------------------------------------------------------------------
package * version date source
assertthat 0.2.0 2017-04-11 CRAN (R 3.4.3)
base * 3.4.1 2017-06-30 local
binman * 0.1.1 2018-07-18 CRAN (R 3.4.4)
bitops 1.0-6 2013-08-17 CRAN (R 3.4.1)
caTools 1.17.1.1 2018-07-20 CRAN (R 3.4.4)
compiler 3.4.1 2017-06-30 local
crayon 1.3.4 2017-09-16 CRAN (R 3.4.3)
curl 3.2 2018-03-28 CRAN (R 3.4.4)
datasets * 3.4.1 2017-06-30 local
decapitated * 0.3.0 2018-10-10 Github (hrbrmstr/decapitated@842cc72)
devtools 1.13.5 2018-02-18 CRAN (R 3.4.3)
digest 0.6.17 2018-09-12 CRAN (R 3.4.4)
graphics * 3.4.1 2017-06-30 local
grDevices * 3.4.1 2017-06-30 local
HARtools 0.0.5 2016-11-09 CRAN (R 3.4.4)
htmltools 0.3.6 2017-04-28 CRAN (R 3.4.3)
htmlwidgets 1.0 2018-01-20 CRAN (R 3.4.3)
httr 1.3.1 2017-08-20 CRAN (R 3.4.3)
jsonlite 1.5 2017-06-01 CRAN (R 3.4.3)
knitr 1.20 2018-02-20 CRAN (R 3.4.4)
magick 1.9 2018-05-11 CRAN (R 3.4.4)
magrittr 1.5 2014-11-22 CRAN (R 3.4.3)
memoise 1.1.0 2017-04-21 CRAN (R 3.4.4)
methods * 3.4.1 2017-06-30 local
openssl 1.0.2 2018-07-30 CRAN (R 3.4.4)
processx 3.2.0 2018-08-16 CRAN (R 3.4.4)
ps 1.1.0 2018-08-10 CRAN (R 3.4.4)
R6 2.2.2 2017-06-17 CRAN (R 3.4.3)
rappdirs 0.3.1 2016-03-28 CRAN (R 3.4.3)
Rcpp 0.12.16 2018-03-13 CRAN (R 3.4.4)
RSelenium * 1.7.4.9000 2018-10-12 Github (ropensci/RSelenium@7509b81)
rstudioapi 0.7 2017-09-07 CRAN (R 3.4.3)
Rwordseg 0.2-1 2013-12-15 R-Forge (R 3.0.2)
semver 0.2.0 2017-01-06 CRAN (R 3.4.3)
stats * 3.4.1 2017-06-30 local
tools 3.4.1 2017-06-30 local
utils * 3.4.1 2017-06-30 local
wdman * 0.2.4 2018-07-21 CRAN (R 3.4.4)
withr 2.1.1 2017-12-19 CRAN (R 3.4.3)
XML 3.98-1.16 2018-08-19 CRAN (R 3.4.4)
xml2 1.2.0 2018-01-24 CRAN (R 3.4.4)
yaml 2.1.14 2016-11-12 url

library(wdman)
library(binman)
library(RSelenium)

eCaps <- list(
chromeOptions = list(
args = c('--headless','--disable-gpu','--windows-size = 1280,800'),
prefs = list(
"profile.default_content_settings.popups" = 0L,
"download.prompt_for_download" = FALSE,
"download.default_directory" = getwd()
)
)
)

cDrv <- wdman::chrome()

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

Headless Chrome can not be used, I find many way, but still not solved, version of chromedriver and selenium well, Some one can help me , thanks a lot.

from wdman.

yonicd avatar yonicd commented on August 18, 2024

has this changed again? i cant seem to get the headless download to work again to a preset path. (without headless it works ok)

from wdman.

QizhiSu avatar QizhiSu commented on August 18, 2024

@juyeongkim I did as you suggest, but I get an error:

Selenium message:POST /session/2b7c93dec093bffbbc2e28e54bd5eaf8/chromium/send_command
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: 'SUKIS', ip: '192.168.174.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_271'
Driver info: driver.version: unknown

Error: Summary: UnknownCommand
Detail: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource.
Further Details: run errorDetails method

Any clue?

from wdman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.