Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

Screenshot fails on Windows, if there's no c:\tmp folder #129

Closed
TravelingTechGuy opened this issue Aug 1, 2017 · 3 comments
Closed

Screenshot fails on Windows, if there's no c:\tmp folder #129

TravelingTechGuy opened this issue Aug 1, 2017 · 3 comments

Comments

@TravelingTechGuy
Copy link

TravelingTechGuy commented Aug 1, 2017

If you don't have a c:\tmp folder in Windows (and it is not there by default), then calling .screenshot() results in:

{ Error: ENOENT: no such file or directory, open 'C:\tmp\cj5tupcpw0000fgl2l9a1dvl8.png'
    at Object.fs.openSync (fs.js:652:18)
    at Object.fs.writeFileSync (fs.js:1299:33)
    at LocalRuntime.<anonymous> (C:\Users\user\Code\headless-chrome\node_modules\chromeless\dist\src\chrome\local-runtime.js:354:28)
    at step (C:\Users\user\Code\headless-chrome\node_modules\chromeless\dist\src\chrome\local-runtime.js:32:23)
    at Object.next (C:\Users\user\Code\headless-chrome\node_modules\chromeless\dist\src\chrome\local-runtime.js:13:53)
    at fulfilled (C:\Users\user\Code\headless-chrome\node_modules\chromeless\dist\src\chrome\local-runtime.js:4:58)
    at <anonymous>
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\tmp\\cj5tupcpw0000fgl2l9a1dvl8.png' }

Manually creating that folder solves the problem, but I think the function should either:

  1. Allow providing a path to save the screenshot at (best)
  2. Get the location of the Windows (or other OS) tmp folder, and use that
@gvangool
Copy link

gvangool commented Aug 2, 2017

FYI, if you start chromeless from a path on a different disk (e.g. X:).
You'll need the directory on that drive.

gvgool@W10PRO2 MINGW64 ~
$ find /c -name cj5upsz4d00007weeu6m9t5t5.png 2>/dev/null

gvgool@W10PRO2 MINGW64 ~
$ find /x -name cj5upsz4d00007weeu6m9t5t5.png 2>/dev/null
/x/tmp/cj5upsz4d00007weeu6m9t5t5.png

@seangransee
Copy link
Contributor

This should get resolved once someone takes on #113. Part of @adieuadieu's acceptance criteria is to make use of os.tmpdir() for screenshots and PDFs, which should solve the cross-platform problem.

elisherer pushed a commit to elisherer/chromeless that referenced this issue Aug 3, 2017
@adieuadieu adieuadieu added this to the v1.2 milestone Aug 4, 2017
@adieuadieu
Copy link
Collaborator

Resolved with #137 & #172

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

No branches or pull requests

4 participants