rubycdp / ferrum

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

Browser option --kiosk not working #460

Open Abvgdejg opened 5 months ago

Abvgdejg commented 5 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 5 months ago

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

Abvgdejg commented 5 months ago

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

Added code