Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement screencasting #507

Closed
wants to merge 5 commits into from
Closed

Implement screencasting #507

wants to merge 5 commits into from

Conversation

singhprd
Copy link

@singhprd singhprd commented Jan 2, 2025

Work in progress.

To use this:

page.driver.browser.page.start_screencast
page.driver.browser.page.stop_screencast

This only saves images, it's not true video/screencasting but that is actually what Chrome provides.
This could become a 'real' screencast by streaming the images received from Chrome to something that combines them into a video (ffmpeg), but that would require much more complication in this Gem - and can just be done by a user later.

They should be very helpful for viewing and debugging tests.

Taken from this issue discussion: #354

Todo:

lib/ferrum/page.rb Outdated Show resolved Hide resolved
@page.command("Page.screencastFrameAck", sessionId: params["sessionId"])

ts = (Time.now.to_f * 1000).to_i
File.binwrite("img_#{ts}.jpeg", Base64.decode64(params["data"]))
Copy link
Author

@singhprd singhprd Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could maybe put this in a background thread to stop from blocking and get more frames per second. Needs tested.

@singhprd singhprd closed this Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants