fzaninotto / screenshot-as-a-service

Website screenshot service powered by node.js and phantomjs
1.1k stars 243 forks source link

DOM Manipulation #6

Closed MaximOrlovsky closed 12 years ago

MaximOrlovsky commented 12 years ago

Is there a place where I can make DOM manipulation before render? Working with DOM in 'scripts/rasterizer.js' in 'server.listen' doesnt give any results.

fzaninotto commented 12 years ago

I believe you're looking at the right place - your manipulations should occur before line 84. If it doesn't work, this is a phantomjs problem.

MaximOrlovsky commented 12 years ago

Yes, Francois. This is the first place that i tried, but it doesn't work. Even when I made a few 'console.log(...)' and add some 'response.write(..)' inside 'service = server.listen...' I did not see any messages in console or response.

My next move: I comment whole file rasterizer.js, reboot nodejs and phantomjs — the app works as usual, makes screenshots as usual. But when I made empty file rasterizer.js — phantomjs shows error, when I left in file only one line of code — console.log('rasterizer text') — nodejs shows me this message and makes the screenshot.

I also tried node-inspector to debug the app. But I never rich inside 'service = server.listen...' of rasterizer.js

I understand all of this sounds strange, but I tried to find the solution a couple of days and did not found the reason. I really looking for your help.


System Centos NodeJs 0.6.18 PhantomJs 1.6.1

fzaninotto commented 12 years ago

It is normal that you don't see the logs - the phantomjs process is spawned from the main process. In order to debug, you should start the rasterizer.js script manually using the phantomjs command.

2012/7/23 Max < reply@reply.github.com

Yes, Francois. This is the first place that i tried, but it doesn't work. Even when I made a few 'console.log(...)' and add some 'response.write(..)' inside 'service = server.listen...' I did not see any messages in console or response.

My next move: I comment whole file rasterizer.js, reboot nodejs and phantomjs — the app works as usual, makes screenshots as usual. But when I made empty file rasterizer.js — phantomjs shows error, when I left in file only one line of code — console.log('rasterizer text') — nodejs shows me this message and makes the screenshot.

I also tried node-inspector to debug the app. But I never rich inside 'service = server.listen...' of rasterizer.js


Reply to this email directly or view it on GitHub:

https://github.com/fzaninotto/screenshot-as-a-service/issues/6#issuecomment-7173289

MaximOrlovsky commented 12 years ago

Yes, its spawned, but I see messages ( console.log(...) ) before 'service = server.listen...' in the console.

MaximOrlovsky commented 12 years ago

Everything is ok, it was my fault. Now messages are showing even from 'service = server.listen...' Thanks for your help. Sometimes we need to write problem to understand it.