Showing posts with label Screenshot. Show all posts
Showing posts with label Screenshot. Show all posts

Sunday, July 18, 2010

Cucumber Screenshot

Cucumber Screenshot makes it easy to capture HTML snapshots and PNG screenshots of the pages generated by your Rails application as it runs your Cucumber/Webrat features.
It uses WebKit to generate the PNG screenshots and so they are only available for OS X.
If you want to take bitmap screenshots on any other platform then take a look at this example from Cucumber.

http://github.com/mocoso/cucumber-screenshot

Make a browser screenshot in Ruby with Selenium


First you need to have Selenium RC installed and launched. It's pretty simple. Download it, go to the selenium-server-1.0 and enter in command line
java -jar selenium-server.jar
Your Selenium server is started on the 4444 port, ready to be used ! You also need the selenium-client installed.
sudo gem install selenium-client
Your hard drive is now a bit less empty. We can start having fun with code !
require 'rubygems'
require 'selenium'

# We load Selenium
@selenium = Selenium::SeleniumDriver.new("localhost", 4444, "*firefox", "http://42.dmathieu.com/", 10000);
@selenium.start

# We go to the main page and take the screenshot
@selenium.open "/"
@selenium.capture_entire_page_screenshot(File.expand_path(File.dirname(__FILE__)) + 'screenshot.png', '');

# We unload Selenium
@selenium.stop
We load the required libraries. Not complicated. We only need Selenium.

require 'rubygems'
require 'selenium'
Then we load Selenium, indicating the URL we wish to visit and the browser with which we want to visit it.
@selenium = Selenium::SeleniumDriver.new("localhost", 4444, "*firefox", "http://42.dmathieu.com/", 10000);
@selenium.start
We load the page, take the screenshot and save the created image.
@selenium.open "/"
@selenium.capture_entire_page_screenshot(File.expand_path(File.dirname(__FILE__)) + 'screenshot.png', '');
And we don't forget to free the memory.
@selenium.stop
And then the magic happens. Our beautiful screenshot (of the entire page, not only the screen) is then generated.

http://dmathieu.com/en/ruby/make-a-browser-screenshot-in-ruby-with-selenium

Win32::Screenshot

Capture Screenshots on Windows with Ruby. This library captures screenshots in bmp format, but you may use RMagick to convert these to some other formats like png.


http://github.com/jarmo/win32screenshot

JRuby Toolkit Robot example - How take a screenshot of your desktop

require 'java'

include_class 'java.awt.Dimension'
include_class 'java.awt.Rectangle'
include_class 'java.awt.Robot'
include_class 'java.awt.Toolkit'
include_class 'java.awt.event.InputEvent'
include_class 'java.awt.image.BufferedImage'
include_class 'javax.imageio.ImageIO'

toolkit = Toolkit::getDefaultToolkit()
screen_size = toolkit.getScreenSize()
rect = Rectangle.new(screen_size)
robot = Robot.new
image = robot.createScreenCapture(rect)
f = java::io::File.new('test.png')
ImageIO::write(image, "png", f)

http://www.devdaily.com/blog/post/ruby/jruby-code-that-takes-screenshot-of-your-desktop-saves-it-as-fi

Wednesday, July 14, 2010

Making urls look memorable

Bluga.net WebThumb provides a white-label web service API for generating web thumbnails and full size snapshots of websites.
WebThumb offers more features and quicker response times then any other service.
  • Real-time thumbnails
  • Flash 10 Support
  • PDF Support
  • Quick response times
  • REST API
  • API clients for PHPRubyPython
  • Cache the thumbnails on your server or Webthumbs
  • Browser windows from 75x75 to 1280x2048
http://snippets.dzone.com/posts/show/3621
http://www.paulhammond.org/webkit2png/
http://stackoverflow.com/questions/726660/how-do-i-make-beautiful-screenshots-of-web-pages-using-ruby-and-a-unix-server
rbwebkitgtkhttp://github.com/danlucraft/rbwebkitgtk/tree/master

Moz snap shooterhttp://www.lilik.it/~mirko/Ruby-GNOME2/moz-snapshooter.rb
http://www.hackdiary.com/2004/06/13/taking-automated-webpage-screenshots-with-embedded-mozilla/

Selenium RC has a Ruby interface and can grab a screenshot using: http://release.seleniumhq.org/selenium-remote-control/1.0-beta-2/doc/ruby/classes/Selenium/Client/GeneratedDriver.html#M000220

PageGlimpse is a service providing developers with programatic access to thumbnails of any web page. The thumbnails can be virtually used in any kind of applications that require the display of website screenshots: web sites, windows/linux/mac applications, iPhone/mobile utilities, browser plugins, etc. 
Including web site thumbnails in your application will dramatically improve the user experience. The service is easy to use, fast and reliable, no restriction on thumbnail sizes or number of hits. Click here to see how it works.
http://www.pageglimpse.com/



Browsershots

Browsershots makes screenshots of your web design in different operating systems and browsers. It is a free open-source online web application providing developers a convenient way to test their website's browser compatibility in one place. When you submit your web address, it will be added to the job queue. A number of distributed computers will open your website in their browser. Then they will make screenshots and upload them to our central dedicated servers for your review.

http://browsershots.org/