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

How to run webshot2 on a Linux server? #47

Open
lijinbio opened this issue Feb 17, 2023 · 2 comments
Open

How to run webshot2 on a Linux server? #47

lijinbio opened this issue Feb 17, 2023 · 2 comments

Comments

@lijinbio
Copy link

Hi,

I am trying to run webshot2::webshot() on a Linux server. The server does not have Chrome, and I got the below error that Chrome is not found.

`google-chrome` and `chromium-browser` were not found. Try setting the CHROMOTE_CHROME environment variable or adding one of these executables to your PATH.
Error in initialize(...) : Invalid path to Chrome
Calls: source ... <Anonymous> -> initialize -> <Anonymous> -> initialize
Execution halted

I understand webshot2 uses Chrome back-end, but my account in the server can only install local tools using conda. Could you please help suggest any workaround? Either install a local Chrome? or another solution without a browser? Thanks.

@AroneyS
Copy link

AroneyS commented Apr 11, 2023

I tried installing chromium through conda (https://anaconda.org/esss/chromium) and then setting the env variable CHROMOTE_CHROME to the path for chrome install by that package. But I just get a different error:

webshot2::webshot("https://www.r-project.org", file = "test.png")

# https://www.r-project.org screenshot completed
# Warning messages:
# 1: In onRejected(...) :
#  An error occurred: Error in self$Page$captureScreenshot(clip = list(x = xmin, y = ymin, width = xmax - : unused argument (captureBeyondViewport = TRUE)

# 2: In normalizePath(value) :
#   path[1]="An error occurred: Error in self$Page$captureScreenshot(clip = list(x = xmin, y = ymin, width = xmax - : unused  argument (captureBeyondViewport = TRUE)
# ": No such file or directory

Similar error to rstudio/gt#1029, though they only get the error running webshot2 through gt and not running webshot2 directly.

@henrique1008
Copy link

henrique1008 commented Jun 15, 2023

Hi
I see you mentioned my issue in gt
This: rstudio/gt#1029

I've been looking deeper into this, and found out what part of the webshot was having the problem.

If I run
webshot2::webshot("path to gt table saved in html with htmltools", file = "test.png")
Everything is fine, but the image is blank

But if I run
webshot2::webshot("path to gt table saved in html with htmltools", file = "test.png",selector = "table")
This broke

file:////tmp/RtmpFJCC7k/file99d1167031a0f.html screenshot completed
Warning messages:
1: In onRejected(...) :
  An error occurred: Error in onFulfilled(value): Unable to find any visible elements for selectors.

2: In normalizePath(value) :
  path[1]="An error occurred: Error in onFulfilled(value): Unable to find any visible elements for selectors.
": No such file or directory

The problem is in the selector parameter
And that's why I had problems in gt, because it uses selector = 'table'

Hope this helps us to come up with a solution.

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

No branches or pull requests

3 participants