Giter Site home page Giter Site logo

Comments (2)

bersbersbers avatar bersbersbers commented on September 28, 2024

This is what I was looking for:

library(chromote)
b <- ChromoteSession$new()
b$Emulation$setDeviceMetricsOverride(width = 1920, height = 1080, deviceScaleFactor = 1, mobile = FALSE)
b$Page$navigate("https://github.com/rstudio/chromote")
Sys.sleep(3)
b$screenshot("snap.png")

This snapshot comes out at width 1905 and may be the closest case to rstudio/shinytest2#171, and it is the case which is actually fixed by b$Emulation$setScrollbarsHidden(TRUE), somewhat regardless of where one puts it.

library(chromote)
b <- ChromoteSession$new()
# b$Emulation$setScrollbarsHidden(TRUE) # works
b$Emulation$setDeviceMetricsOverride(width = 1920, height = 1080, deviceScaleFactor = 1, mobile = FALSE)
# b$Emulation$setScrollbarsHidden(TRUE) # works
b$Page$navigate("https://github.com/rstudio/chromote")
b$Emulation$setScrollbarsHidden(TRUE) # works
Sys.sleep(3)
b$screenshot("snap.png")

This snapshot is 1920 pixels wide, as expected. Interestingly, screenshot() does call setScrollbarsHidden already, but that call seems to be ineffective for some reason:

p <- self$Emulation$setScrollbarsHidden(hidden = TRUE, wait_ = FALSE)$

from chromote.

hadley avatar hadley commented on September 28, 2024

Closing, since it seems like you figured out a solution.

from chromote.

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.