Sha256: 642c774485bec2875670f8b60ec308064554307a40fa11d5559759d825819e3a
Contents?: true
Size: 1.45 KB
Versions: 8
Compression:
Stored size: 1.45 KB
Contents
# needs the selenium-webdriver and mini_magick gems ] require 'eyes_selenium' # Substitute these with the size of your web page page_width = 1024 page_height = 800 height_captured = 0 y_tiles = 0 wd = Selenium::WebDriver.for :firefox # Connect to your Selenium Webdriver eyes=Applitools::Eyes.new() eyes.api_key = "Peter" eyes.force_fullpage_screenshot = true viewport = Selenium::WebDriver::Dimension.new(1024, 768) driver = eyes.open( app_name: 'Full', test_name: 'FullShot', viewport_size: viewport, driver: wd) asb = Applitools::Selenium::Browser.new(driver, eyes) driver.navigate.to "http://www.concursolutions.com" driver.manage.window.maximize shot=driver.get_screenshot puts __FILE__ + (__LINE__).to_s + " shot => #{shot.class}" if false while height_captured < page_height width_captured = 0 x_tiles = 0 while width_captured < page_width tile_file = "screenshot-#{y_tiles}-#{x_tiles}.png" driver.execute_script("window.scrollTo(#{width_captured}px, #{height_captured});") driver.save_screenshot tile_file screenshot = MiniMagick::Image.new tile_file width_captured += screenshot.width x_tiles += 1 end height_captured += screenshot.height y_tiles += 1 end # Use imagemagick's montage command to stitch the screenshot tiles together `montage screenshot-[0-#(y_tiles}]-[0-#{x_tiles}].png -tile #{x_tiles}x#{y_tiles} -geometry #{screenshot.width}x#{screenshot.height}+0+0 screenshot.png` end driver.quit
Version data entries
8 entries across 8 versions & 1 rubygems