rubycdp / ferrum

Headless Chrome Ruby API
https://ferrum.rubycdp.com
MIT License
1.74k stars 123 forks source link

Browser option --kiosk not working #460

Open Abvgdejg opened 4 months ago

Abvgdejg commented 4 months ago

When creating a browser with the "kiosk" option, placing it on the Xvfb display and recording with ffmpeg, the browser UI elements remain.

Code:

require 'ferrum'

x = Ferrum::Browser::Xvfb.new(OpenStruct.new({ window_size: [1920, 1080] }))
x.start

b = Ferrum::Browser.new(headless: false, xvfb: true,
                        browser_options: {
                          'window-size': '1920,1080',
                          'display': ":#{x.display_id}",
                          'disable-infobars': nil,
                          'kiosk': nil
                        })
b.goto 'https://animejs.com/'

ffmpeg_command = "ffmpeg -y -video_size 1920x1080 -framerate 25 -f x11grab -i :#{x.display_id} -loglevel debug ./#{Time.now.to_i}.mp4"
pid = spawn(ffmpeg_command)
Process.detach(pid)

sleep 4

Process.kill('SIGINT', pid)
Process.kill('SIGINT', x.pid)
b.quit

https://github.com/rubycdp/ferrum/assets/108282610/ca80334c-ee77-47a1-bcab-d96e91da0e2b

route commented 4 months ago

But you don't show any code you are running...

Abvgdejg commented 4 months ago

But you don't show any code you are running...

Added code