class Applitools::Selenium::Driver::FrameChangeEventListener

@!visibility private

Attributes

parent[RW]

def will_switch_to_window(name_or_handle)

end

Public Class Methods

new(parent) click to toggle source
# File lib/applitools/selenium/driver.rb, line 292
def initialize(parent)
  self.parent = parent
end

Public Instance Methods

will_switch_to_frame(target_type, target_frame) click to toggle source
# File lib/applitools/selenium/driver.rb, line 296
def will_switch_to_frame(target_type, target_frame)
  logger.info 'will_switch_to_frame()'
  case target_type
  when :default_content
    logger.info 'Default content.'
    parent.frame_chain!.clear
    return nil
  when :parent_frame
    logger.info 'Parent frame.'
    return parent.frame_chain!.pop
  when :frame
    logger.info 'Frame.'
    frame_location_size = Applitools::Selenium::BorderAwareElementContentLocationProvider.new target_frame
    return parent.frame_chain!.push(
      Applitools::Selenium::Frame.new(
        reference: target_frame, frame_id: '',
        location: Applitools::Location.for(frame_location_size.location),
        size: Applitools::RectangleSize.for(frame_location_size.size),
        parent_scroll_position: Applitools::Selenium::ScrollPositionProvider.new(parent).current_position
      )
    )
  else
    raise Applitools::EyesError.new('will_switch_to_frame(): target type is not recognized!')
  end
  logger.info 'Done!'
end