Sha256: 93e980955482c7902459474c57db3ddbd3d4c101f4c07e999948d03f24f9a083
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
# encoding: binary require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe "Screenshot" do it "can capture html for current page" do page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html" page.get_html_source.should =~ /<head>/ end it "captures PNG screenshot OS viewport as a file on Selenium RC local filesystem" do tempfile = File.join(Dir.tmpdir, "selenium_screenshot.png") page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html" page.capture_screenshot tempfile File.exists?(tempfile).should be_true File.open(tempfile, "rb") do |io| magic = io.read(4) magic.should == "\211PNG" end end it "captures PNG screenshot OS viewport as a Base64 encoded PNG image" do page.open "http://localhost:4444/selenium-server/org/openqa/selenium/tests/html/test_click_page1.html" encodedImage = page.capture_screenshot_to_string pngImage = Base64.decode64(encodedImage) pngImage.should =~ /^\211PNG/n end end
Version data entries
3 entries across 3 versions & 1 rubygems