Skip to content

Window recording in Linux and Mac

Lakshya Kapoor edited this page Mar 15, 2019 · 2 revisions

Linux (x11grab) and macOS (avfoundation) do not support window recording, so here is a workaround.

This will grab the image from desktop, starting with the upper-left corner at x=100, y=200 with a width and height of 1024⨉768.

advanced = { video_size: '1024x768' }
ScreenRecorder::Desktop.new(input: ':0.0+100,200' output: 'recording.mp4' )

Of course, this will require you to move the application window within this recording area first.

Selenium

@driver.manage.window.move_to(100, 200)

Watir

browser.window.move_to(100, 200)

Sources

https://trac.ffmpeg.org/wiki/Capture/Desktop

https://stackoverflow.com/questions/47303753/simplify-move-and-maximise-screen-using-selenium-ruby

https://www.rubydoc.info/gems/watir-webdriver/Watir%2FWindow:move_to

Clone this wiki locally