2

This is not about viewport. The viewport is ok. One thing is the viewport size of the screen, width and height, and another is the graphical interface browser (window), that is opened when you run casperjs test.js --engine=slimerjs.

It's ok that the browser opens when I run casperjs test.js --engine=slimerjs, very useful for testing purposes. But when I stopped testing and want to do something bigger I don't want that browser window open 10 times or 100 times.

I've been reading a while and couldn't find any in the documentation, google or here.

If this is possible, throw the command, I will be very grateful for that. Thank you very much.

Gerardo Cordero
  • 164
  • 4
  • 14
  • Possible duplicate of [Turn off slimerJs viewport](http://stackoverflow.com/questions/33142086/turn-off-slimerjs-viewport) – Artjom B. Jul 27 '16 at 18:27
  • This is not about viewport. The viewport is ok. One thing is the viewport size of the screen, width and height, and another is the graphical interface browser (window), that is opened when you run casperjs test.js --engine=slimerjs. – Gerardo Cordero Jul 27 '16 at 19:07
  • IF I didn't use viewports sizes, I won't get any images sizes when doing casper.capture("image.png"), that is another reason why this is a different question from that. – Gerardo Cordero Jul 27 '16 at 19:15
  • It's the same question. The only difference is that the asker thought of a "solution" (reduce the viewport) that didn't work. A good indication that the question is the same is that the answer is *exactly* the same. – Artjom B. Jul 27 '16 at 20:47
  • Sure, in that case, that questions has a wrong title. I search before to ask, and what I need has nothing to do with the viewport, as I said I need the viewport, I don't need the window browser of slimerjs. – Gerardo Cordero Jul 27 '16 at 21:25

2 Answers2

4

Had the same requirement. xvfb (virtual frame buffer) does this work easily Install xvfb with this command.

sudo apt-get install xvfb

Then run it using this prefix.

xvfb-run -a 

So run the command like

xvfb-run -a casperjs tests.js --engine=slimerjs 

This will run the application in the headless mode.

Nirojan Selvanathan
  • 10,066
  • 5
  • 61
  • 82
2

Yes, it`s possible, you can hidden window with xvfb util. How to do it. Docs

Artem Chernov
  • 856
  • 2
  • 8
  • 26
  • Thank you! Does work nice, xvfb-run casperjs tests.js --engine=slimerjs . The docs says that any window will be shown, but the memory usage will be the same as if the windows open? – Gerardo Cordero Jul 27 '16 at 15:15
  • Xvfb performs all graphical operations in memory without showing any screen output. – Artem Chernov Jul 27 '16 at 15:30