leonid-shevtsov / headless

Create a virtual X screen from Ruby, record videos and take screenshots.
http://leonid.shevtsov.me/en/headless
MIT License
968 stars 113 forks source link

read_nonblock issue #78

Closed Scalpweb closed 8 years ago

Scalpweb commented 8 years ago

Hi,

When I'm trying to execute a simple script, I get the following error :

/usr/local/share/gems/gems/headless-2.2.0/lib/headless.rb:193:in read_nonblock': end of file reached (EOFError) from /usr/local/share/gems/gems/headless-2.2.0/lib/headless.rb:193:inensure_xvfb_is_running' from /usr/local/share/gems/gems/headless-2.2.0/lib/headless.rb:184:in launch_xvfb' from /usr/local/share/gems/gems/headless-2.2.0/lib/headless.rb:172:inblock in pick_available_display' from /usr/local/share/gems/gems/headless-2.2.0/lib/headless.rb:168:in each' from /usr/local/share/gems/gems/headless-2.2.0/lib/headless.rb:168:inpick_available_display' from /usr/local/share/gems/gems/headless-2.2.0/lib/headless.rb:164:in attach_xvfb' from /usr/local/share/gems/gems/headless-2.2.0/lib/headless.rb:88:ininitialize' from record.rb:5:in new' from record.rb:5:in

'

My script :

require 'rubygems' require 'headless' require 'selenium-webdriver'

headless = Headless.new(:dimensions => '1280x720', :video => { :frame_rate => 30, :codec => 'libx264', :provider => 'ffmpeg', :provider_binary_path => 'ffmpeg' }) headless.start

driver = Selenium::WebDriver.for :firefox driver.manage().window().maximize() driver.navigate.to 'https://www.livewebinar.com/BotAccess/47' puts driver.title

headless.video.start_capture

sleep(60)

headless.video.stop_and_save("/root/videos/video.mov") headless.destroy

Scalpweb commented 8 years ago

Nevermind, sorry, I found it... I was not setting the resolution properly.

Wrong : :dimensions => '1280x720' Correct : :dimensions => '1280x720x24'