Class: Applitools::Selenium::FullpageScreenshot
- Inherits:
-
EyesScreenshot
- Object
- EyesScreenshot
- EyesScreenshot
- Applitools::Selenium::FullpageScreenshot
- Defined in:
- lib/applitools/selenium/fullpage_screenshot.rb
Instance Attribute Summary
Attributes inherited from EyesScreenshot
Instance Method Summary collapse
- #sub_screenshot(region, _coordinate_type, throw_if_clipped = false, force_nil_if_clipped = false) ⇒ Object
- #top_left_location ⇒ Object
Methods inherited from EyesScreenshot
#convert_location, #initialize, #intersected_region, #location_in_screenshot
Constructor Details
This class inherits a constructor from Applitools::Selenium::EyesScreenshot
Instance Method Details
#sub_screenshot(region, _coordinate_type, throw_if_clipped = false, force_nil_if_clipped = false) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/applitools/selenium/fullpage_screenshot.rb', line 5 def sub_screenshot(region, _coordinate_type, throw_if_clipped = false, force_nil_if_clipped = false) logger.info "get_subscreenshot(#{region}, #{throw_if_clipped})" Applitools::ArgumentGuard.not_nil region, 'region' as_is_subscreenshot_region = region.intersect(image_region) if as_is_subscreenshot_region.empty? || (throw_if_clipped && as_is_subscreenshot_region.size != region.size) return nil if force_nil_if_clipped raise Applitools::OutOfBoundsException.new "Region #{region} is out" \ ' of screenshot bounds' end sub_screenshot_image = Applitools::Screenshot.from_image( image.crop( as_is_subscreenshot_region.left, as_is_subscreenshot_region.top, as_is_subscreenshot_region.width, as_is_subscreenshot_region.height ) ) result = self.class.new(sub_screenshot_image, region_provider: region_provider).tap do |s| s.top_left_location = top_left_location.dup.offset(region.location) end logger.info 'Done!' result end |
#top_left_location ⇒ Object
33 34 35 |
# File 'lib/applitools/selenium/fullpage_screenshot.rb', line 33 def top_left_location @top_left_location ||= Applitools::Location::TOP_LEFT end |