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

Already on GitHub? Sign in to your account

How to just capture screenshot of the window? #14

millisami opened this Issue Oct 17, 2011 · 2 comments


None yet
4 participants

Right now, headless.take_screenshot('./somefile.jpg') works great!

But the saved file has all the Menubar, address bar, scrollbar attached.

Is there any other function call or params that can be passed to just capture the content window only without the Menubars,status bar, scroll bar, ..etc.??


iafonov commented Oct 17, 2011

Currently there is no way to do it via headless. Maybe you can figure it out yourself if you definitely need it. Headless uses import utility from imagemagick and it can accept window id or name (see - man - http://www.imagemagick.org/script/command-line-options.php?ImageMagick=op7slcr8l6l27lekiqiif8e6t2#write), you can pass id/name to take_screenshot method and put it instead of root. (See - https://github.com/leonid-shevtsov/headless/blob/master/lib/headless.rb#L118)

anikkar commented May 24, 2012

You could also enable to browser to full screen:

driver.find_element(:tag_name => 'html').send_keys(Selenium::WebDriver::Keys[:f11]) #full screen cmd for Firefox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment