mixu / electroshot

Capture website screenshots with optional device and network emulation as jpg, png or pdf (with web fonts!) using Electron / Chrome.
548 stars 34 forks source link

Trouble with CSS, JS and Delay #22

Closed kerray closed 7 years ago

kerray commented 7 years ago

Hi, I think there's a bug - CSS and JS parameters stop doing anything once Delay and Height are specified.

It doesn't really matter what url I try to screenshot.

These simple calls should demostrate it - ono the first one page is empty, on the second it's still there

electroshot https://www.seznam.cz 1024 --debug --css="body{display:none;}"

electroshot https://www.seznam.cz 1024x800 --delay 5000 --debug --css="body{display:none;}"

shot v1.4.0 electron v1.6.15 chrome v56.0.2924.87

kerray commented 7 years ago

OK, I just noticed the comment in target-window.js // Note that zoom-factor, selector, js and css are incompatible...

Nevermind then. How big is the chance this could be worked around?

mixu commented 7 years ago

The core limitation is that (at least when I wrote electroshot) the preloaded.js script was only run after the page loaded which means any stuff done via preloaded.js can only happen after a full page loaded which may take an arbitrary number of milliseconds. Electron may have added a new API or you might be able to do some kind of script injecting proxy to get preloaded to run earlier. For my use cases the limitation wasn't a big deal so I opted not to try to figure it out but happy to accept a PR!

On Tue, Oct 17, 2017, 11:39 PM Jaromír Matýšek notifications@github.com wrote:

OK, I just noticed the comment in target-window.js // Note that zoom-factor, selector, js and css are incompatible...

Nevermind then. How big is the chance this could be worked around?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mixu/electroshot/issues/22#issuecomment-337475042, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYUwp_6Bz8wqkvqd3OsEd3of3iB3ywbks5stZ06gaJpZM4P8U-a .

kerray commented 7 years ago

Thanks for the info! If it turns out we really need this, I'll dig deeper.