Capture video with Poltergeist, PhantomJS and Capy

2019-06-22 10:22发布

问题:

Is it possible to capture video with PhantomJS in combination with the gems Poltergeist, Capybara and Cucumber?

I have used the Headless gem previously, which put a video in a specific folder in case a scenario failed. If all went well, no video was stored.

Headless uses Xvfb and ffmpeg. Can ffmpeg also be used to provide the same functionality as shown here: https://github.com/leonid-shevtsov/headless/blob/master/lib/headless/video/video_recorder.rb

I basically need the same functionality, but I have no idea how to go about it. Any advice is highly appreciated.

回答1:

This is a PhantomJS tutorial to record videos: http://mindthecode.com/recording-a-website-with-phantomjs-and-ffmpeg



回答2:

You can't capture video with PhantomJS, but I guess you could hook something up to take a screenshot on each step that Capybara takes (you'd need to dig into the code to do that though).